1. Field of the Invention
The present invention relates to an image composition apparatus and an image composition method that take a plurality of images and composite them into one image. And particularly, the present invention relates to a level-matching technique at the time of compositing a plurality of images.
2. Description of the Related Art
There is a known image composition method that enlarges a dynamic range by taking a plurality of images in different exposures and compositing the taken images. When images are composited in such a manner, a composition process is performed after adjusting levels of the taken images so that the image levels match.
However, the conventional image composition apparatus is difficult to composite images properly when a low exposure image and a high exposure image are taken with exposures that are different from a setting level difference. For example, if shutter speed at the time of taking an image differs from correct speed under influence of a mechanism error etc., images are taken with exposures different from the setting level difference. Accordingly, even if the level matching is performed according to the setting level difference, the image levels of the low exposure image and the high exposure image become different, which decreases an accuracy of process, such as motion detection.
Regarding such a problem, Japanese Laid-Open Patent Publication (Kokai) No. H8-154201 (JP H8-154201A) discloses a technique that calculates a gain ratio based on image signals in a fixed range of an input level and matches the gains of the image signals.
Although the technique disclosed in JP H8-154201A adjusts the gain in the level range in which the input levels of two images to be composited, the images are composited without adjusting the gain in another level range. That is, the technique does not adjust the levels with a fixed gain over the entire area of the image.
Accordingly, when a moving subject exists in a taken image, and when levels overlapping the subject in the image and other levels are intermingled, the levels overlapping the subject in the image and the other levels are adjusted in the different gains, respectively. As a result, pixel values over the boundary do not smoothly vary, and an unnatural image will be generated. When a moving subject is included in a taken image, the adjustment for the moving subject and that for a background may be performed with different gains. In such a case, a difference value of an image varies depending on the brightness of the moving image, which disturbs suitable motion detection.
Japanese Laid-Open Patent Publication (Kokai) No. 2009-147588 (JP 2009-147588A) discloses a technique that acquires an image with a suitable image level by calculating a difference between an evaluation metering value of a taken image and a target evaluation metering value, and amplifying the taken image signal based on the calculated difference.
The technique disclosed in this publication acquires a correct exposure image by applying a sensitivity calibration afterwards to the taken image data. That is, although JP 2009-147588A does not disclose a technique for compositing two images, it discloses a technique that acquires the evaluation metering value about the taken image by dividing the taken image data into the predetermined number of areas, calculating average of brightness values for every divided area, and assigning weights. Specifically, the technique acquires image data with a correct exposure by calculating the evaluation metering value from the image data that was taken beforehand, taking a main image data with the exposure corresponding to the evaluation metering value, calculating a difference between the calculated evaluation metering value and an evaluation value of a correct exposure, and calibrating the sensitivity of the main image data.
However, this method changes the evaluation metering value about the whole image when the taken image includes a moving subject and a part of a subject in the image moves (varies). Accordingly, if the sensitivity calibration is performed according to the evaluation metering value, other subjects that did not move (do not vary) are affected.